package kr.co.doriclassic.powerjava.chapter12;

class TV implements RemoteControl{
	@Override
	public void turnOn() {
		System.out.println("TV ON");
	}

	@Override
	public void turnOff() {
		System.out.println("TV OFF");
	}	
}

class Car implements RemoteControl{

	@Override
	public void turnOn() {
		System.out.println("CAR ON");
	}

	@Override
	public void turnOff() {
		System.out.println("CAR ON");
	}
}
interface RemoteControl {
	public abstract void turnOn();
	void turnOff();
}

public class TestMain{
	public static void main(String[] args) {
		TV tv = new TV();
		Car car = new Car();
		
		RemoteControl[] rc = new RemoteControl[2];
		//TV tv = new TV();
		//Car car = new Car();
		//rc[0]=tv;
		//rc[1]=car;
		rc[0]=new TV();
		rc[1]=new Car();
		
		for (RemoteControl re : rc) {
			re.turnOn();
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			re.turnOff();
		}
	}
}